package com.cqc.googleplay.fragment.home;

import com.cqc.googleplay.R;
import com.cqc.googleplay.view.ContentPager;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
import com.handmark.pulltorefresh.library.PullToRefreshListView;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;
/**
 * 专题
 * @author Administrator
 */
public class SubjectFrag extends Fragment {
	
	private ContentPager contentPager;
	private Context context;
	private View view;
	private PullToRefreshListView ptr;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		context = getActivity();
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		contentPager = new ContentPager(getActivity()) {
			
			@Override
			public Object requestData() {
				return getData();
			}
			
			@Override
			public View createSuccessView() {
				return getSuccessView();
			}
		};
		return contentPager;
	}

	protected Object getData() {
		// TODO Auto-generated method stub
		return null;
	}

	protected View getSuccessView() {
		view = View.inflate(context, R.layout.frag_home, null);
		ptr = (PullToRefreshListView) view.findViewById(R.id.pull_refresh_list);
		ptr.setMode(Mode.BOTH);
		ptr.setOnRefreshListener(new OnRefreshListener<ListView>() {

			@Override
			public void onRefresh(PullToRefreshBase<ListView> refreshView) {
				if (refreshView.getCurrentMode() == Mode.PULL_FROM_START) {//下拉刷新
					
				} else {//下拉加载更多

				}
				
			}
		});
		return view;
	}
	private Handler handler = new Handler(){
		public void handleMessage(android.os.Message msg) {
			
		};
	};
}
